package cn.sxw.android.base.ui;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.zcs.autolayout.AutoLayoutActivity;

import cn.sxw.android.R;
import cn.sxw.android.base.utils.UserAgreementUtils;

/**
 * Created by zhanghai on 2019/12/22.
 * function：
 */
public class UserAgreementActivity extends AutoLayoutActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_agreement);

        ImageView iv_back = findViewById(R.id.iv_back);
        iv_back.setOnClickListener(v -> finish());

        TextView tv_agreement_title = findViewById(R.id.tv_agreement_title);
        TextView tv_agreement_content = findViewById(R.id.tv_agreement_content);

        int flag = getIntent().getIntExtra(UserAgreementUtils.EXTRA_FLAG, UserAgreementUtils.TYPE_USER_AGREEMENT);
        if (flag == UserAgreementUtils.TYPE_USER_AGREEMENT) {
            tv_agreement_title.setText(getCurString(R.string.str_kt_agreement_title));
            tv_agreement_content.setText(getCurString(R.string.str_kt_user_agreement));
        } else if (flag == UserAgreementUtils.TYPE_USER_PRIVATE_AGREEMENT) {
            tv_agreement_title.setText(getCurString(R.string.str_kt_private_agreement_title));
            tv_agreement_content.setText(getCurString(R.string.str_kt_user_private_agreement));
        }
    }

    private String getCurString(int id) {
        return getResources().getString(id);
    }
}
